﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true"
    CodeBehind="Edit.aspx.cs" Inherits="Kym.Web.Views.Contacts.Edit" %>
<%@ Import Namespace="MvcContrib"%>
<%@ Import Namespace="Kym.Web.Controllers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
$(function() {
    $("#Contacts").validate({
        rules: {
            "Contact.Name": {
                required: true,
                remote: '<%= Url.Action("ContactNameAvailable") %>'
            }
        },
        messages: {
            "Contact.Name": {
                remote: jQuery.format("Contact with name {0} already exists")
            }
        }
    });
});
</script>
    <% using (Html.Form("Contacts", "CreateOrUpdate", FormMethod.Post, new Hash(Id => "Contacts")))
       {%>
    <%= Html.Hidden("Contact.ID") %>
    <label for="Contact.Name">Name</label>
    <%= Html.TextBox("Contact.Name") %>
    <%= Html.SubmitButton("Save", "Save") %>
    <% } %>
</asp:Content>
